﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                            xmlns:Primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls"
 xmlns:RIControls="clr-namespace:StockTraderRI.Controls">

    <Style TargetType="RIControls:AnimatedTabControl">
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Background" Value="{x:Null}"/>
        <Setter Property="BorderThickness" Value="2"/>

        <Setter Property="Padding" Value="5"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RIControls:AnimatedTabControl">
                    <Grid x:Name="LayoutRoot">
                        <Grid.Resources>
                            <Storyboard x:Name="StartingTransition">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ContentGrid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.3" Value="0" KeySpline="0.5,0,1,1"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Name="EndingTransition">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ContentGrid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.3" Value="1" KeySpline="0,0,0,1"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </Grid.Resources>
                        <Grid x:Name="TemplateTop" Visibility="Collapsed">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Border Height="30" HorizontalAlignment="Left" VerticalAlignment="Top" Width="Auto" Grid.Row="1" CornerRadius="12,12,12,12" Background="{StaticResource headerBarBG}" BorderThickness="2,2,2,2" BorderBrush="#FFFFFFFF">
                                <Primitives:TabPanel HorizontalAlignment="Center" x:Name="TabPanelTop" VerticalAlignment="Center" Canvas.ZIndex="1" Opacity="1"/>
                            </Border>
                            <Grid Margin="0,40,0,0" Grid.Row="1" RenderTransformOrigin="0.5,0.5" x:Name="ContentGrid">
                                <Grid.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform/>
                                        <SkewTransform/>
                                        <RotateTransform/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </Grid.RenderTransform>
                                <RIControls:RoundedBox />
                                <ContentPresenter Cursor="{TemplateBinding Cursor}" x:Name="ContentTop" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalAlignment}" Opacity="0.7"/>
                                <ContentControl x:Name="BufferView" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalAlignment}" Opacity="0.7" />
                            </Grid>
                        </Grid>
                        <Grid x:Name="TemplateBottom" Visibility="Collapsed">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Primitives:TabPanel Margin="2,-1,2,2" x:Name="TabPanelBottom" Grid.Row="1" Canvas.ZIndex="1"/>
                            <Border x:Name="ContentBorder" MinHeight="10" MinWidth="10" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3,3,0,0">
                                <ContentPresenter Cursor="{TemplateBinding Cursor}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" Margin="{TemplateBinding Padding}" x:Name="ContentBottom" VerticalAlignment="{TemplateBinding VerticalAlignment}"/>
                            </Border>
                        </Grid>
                        <Border x:Name="DisabledVisualBottom" IsHitTestVisible="False" Opacity="0" Canvas.ZIndex="1" Background="#8CFFFFFF" CornerRadius="3,3,0,0" />
                        <Grid x:Name="TemplateLeft" Visibility="Collapsed">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Primitives:TabPanel Margin="2,2,-1,2" x:Name="TabPanelLeft" Canvas.ZIndex="1"/>
                            <Border MinHeight="10" MinWidth="10" Grid.Column="1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0,3,3,0">
                                <ContentPresenter Cursor="{TemplateBinding Cursor}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" Margin="{TemplateBinding Padding}" x:Name="ContentLeft" VerticalAlignment="{TemplateBinding VerticalAlignment}"/>
                            </Border>
                            <Border x:Name="DisabledVisualLeft" IsHitTestVisible="False" Opacity="0" Grid.Column="1" Canvas.ZIndex="1" Background="#8CFFFFFF" CornerRadius="0,3,3,0"/>
                        </Grid>
                        <Grid x:Name="TemplateRight" Visibility="Collapsed">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Primitives:TabPanel Margin="-1,2,2,2" x:Name="TabPanelRight" Grid.Column="1" Canvas.ZIndex="1"/>
                            <Border MinHeight="10" MinWidth="10" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3,0,0,3">
                                <ContentPresenter Cursor="{TemplateBinding Cursor}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" Margin="{TemplateBinding Padding}" x:Name="ContentRight" VerticalAlignment="{TemplateBinding VerticalAlignment}"/>
                            </Border>
                            <Border Margin="0" x:Name="DisabledVisualRight" IsHitTestVisible="False" Opacity="0" Canvas.ZIndex="1" Background="#8CFFFFFF" CornerRadius="3,0,0,3"/>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderBrush" Value="#FFFFFFFF"/>
    </Style>

</ResourceDictionary>
